package com.whynot.frame.designMode.singleton;
/**
 * 登记式的单例模式
 * @author chenyao
 * 
 * 优点：采用内部类的机制，结合懒汉式和恶汉试的优缺点
 */
public class SingletonMode3 {
	
	/**
	 * 此类不能被实例化
	 */
	private SingletonMode3() {
	}
	
	/**
	 * 内部类获取instance
	 * @author chenyao
	 *
	 */
	private static class SingletonModeHandler{
		private static final SingletonMode3 instance = 
				new SingletonMode3();
	}
	
	/**
	 * 获取实例对象
	 * @return SingletonMode3
	 */
	public static SingletonMode3 getInstance(){
		return SingletonModeHandler.instance;
	}
}
